home *** CD-ROM | disk | FTP | other *** search
-
- /*******************************************************************************
- ********************************************************************************
- ********************************************************************************
-
- PERMISSION TO COPY THIS SOFTWARE IS HEREBY GIVEN BY THE AUTHOR PROVIDED THAT
- THIS LEADING MESSAGE IS INCLUDED IN ALL OF THE RELEVANT SOURCE FILES.
-
- P. SCHMITZ, UNIVERSITY OF KEELE, MAY 1988.
-
-
- ********************************************************************************
- ********************************************************************************
- *******************************************************************************/
- #include "header.h"
-
- collision(cp,c)
- register struct player *cp;
- char c;
- {
- /*check for any collisions*/
- switch (c)
- {
-
- case '@' :
- {
- plot1(cp,"You were sucked into a black hole and whirled out again. ");
- plot2(cp,"This means your weapons have been damaged. Better dock!");
- cp->phaserbanks=0;
- cp->photontorpedos=0;
- plotphaserbanks(cp);
- plotphotontorpedos(cp);
- if (cp->stat!=5) plotstatus(cp,4);
- break;
- }
- case 'O' :
- {
- plot1(cp," You crashed into a planet. Oh dear, Oh dear, ");
- plot2(cp," The crater you left was 12 miles wide. Your'e Dead! ");
- if (cp->reason>0) cp->reason= -1;
- finish(cp);
- break;
- }
- case '.' :
- {
- cp->maxenergy -= 30;
- cp->energy -= 30;
- plotenergy(cp);
- plotmaxenergy(cp);
- plot1(cp," You collided with a star. Warp capability has been ");
- plot2(cp," reduced by 30, and your energy is 30 lower now. ");
- if (cp->stat!=5) plotstatus(cp,4);
- break;
- }
- case 'k' :
- {
- cp->maxenergy -= 100;
- cp->energy -= 100;
- plotenergy(cp);
- plotmaxenergy(cp);
- plot1(cp," You collided with a klingon mevisic mine... ");
- plot2(cp," Energy and Maxenergy have dropped by 100. ");
- if (cp->stat!=5) plotstatus(cp,4);
- break;
- }
- case '#' :
- {
- cp->maxenergy -= 400;
- cp->energy -= 400;
- plotenergy(cp);
- plotmaxenergy(cp);
- plot1(cp," You collided with a Romulan Warning buoy. ");
- plot2(cp," Energy and Maxenergy have dropped by 400. ");
- if (cp->stat!=5) plotstatus(cp,4);
- break;
- }
- case 'o' :
- {
- if (cp->doneit==1)
- {
- plot1(cp," You CANNOT try that again you moron!!! That would ");
- plot2(cp," allow anyone to get any score.....bye bye........ ");
- if (cp->reason>0) cp->reason= -5;
- finish(cp);
- break;
- } else
- {
- cp->maxvel+=1;
- cp->score+=100;
- plotscore(cp);
- cp->maxphaser += 10;
- cp->maxphoton += 10;
- cp->photonpower +=20;
- cp->phaserpower += 20;
- cp->phaserreach +=5;
- cp->photonreach +=5;
- plotphaserbanks(cp);
- plotphotontorpedos(cp);
- cp->doneit=1;
- cp->maxenergy += 110;
- cp->energy += 110;
- plotenergy(cp);
- plotmaxenergy(cp);
- plot1(cp," You fell through a time warp. Just look what this has ");
- plot2(cp," done to your ship. You obviously went into the future!! ");
- break;
- }
- }
- default : break;
- }
- }
-
- finish(x)
- register struct player *x;
- {
- struct player *r;
-
- if (x->stat<12)
- {
- x->chflg=FLAG;
- fire_torpedo(x,'1',1);
- fire_torpedo(x,'2',1);
- fire_torpedo(x,'3',1);
- fire_torpedo(x,'4',1);
- fire_torpedo(x,'8',1);
- fire_torpedo(x,'6',1);
- fire_torpedo(x,'7',1);
- fire_torpedo(x,'9',1);
- plotstatus(x,12);
- x->messindex= -1;
- }
- if (x->id!=ROMID && x->id!=KLINGID)
- {
- beep(x);
- beep(x);
- }
- }
-
- which_sector(x,y,xv,yv)
- int x,y,xv,yv;
- {
- x+=xv;
- x+=xv;
- y+=yv;
- y+=yv;
- if ((x<58)||(x>899)||(y<19)||(y>899)) return(0);
- if ((x>450)&&(x<899))
- {
- if ((y<450)&&(y>19)) return(4);
- else
- if ((y>450)&&(y<899)) return(2);
- }
- if ((x<450)&&(x>58))
- {
- if ((y>450)&&(y<899)) return(1);
- else
- if ((y<450)&&(y>19)) return(3);
- }
- }
-
-